package main

//#cgo CFLAGS: -I${SRCDIR}/num
//#cgo LDFLAGS: -L${SRCDIR} -lnum
//#include "num.h"
//extern double Cut(int a,double b); //以C代码形式提供
import "C"
import (
	"fmt"
	"unsafe"
)

func main() {
	msg := C.CString("Hello, World\n")
	defer C.free(unsafe.Pointer(msg)) //释放内存
	C.Hello(msg)
	fmt.Println(C.Add(C.int(3), C.double(12.5)))
	C.Call(C.cut(C.Cut))
}

//export Cut
func Cut(a C.int, b C.double) C.double {
	fmt.Println("回调....")
	return C.double(a) - b
}
